#include <iostream>
#include<string>
#include<vector>
using namespace std;

void Delete(string& str)
{
    vector<char> v;
    for (auto& e : str)
    {
        if (v.size() == 0)
        {
            v.push_back(e);
            continue;
        }

        if (v.back() == e)
        {
            v.pop_back();
        }
        else
        {
            v.push_back(e);
        }
    }
    str = string(v.begin(), v.end());
}

int main() {
    string str;
    cin >> str;
    Delete(str);
    if (str.size() == 0)
        cout << 0 << endl;
    else
        cout << str << endl;
}